package com.five.wisdomClass.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.five.wisdomClass.entity.Academy;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AcademyMapper extends BaseMapper<Academy> {

    // 查询每个院系的人数
    @Select("SELECT  fc.academy, COUNT(s.id) AS student_count FROM smartcampus.studentinfo s JOIN smartcampus.faculty_category fc ON s.academy = fc.academy GROUP BY fc.f_id, fc.academy")
    List<Academy> getAcademyStudents();
}
